package my.examples.clsunload;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

public class MyClassLoader extends ClassLoader {

    public Class<?> load(String name, String path) {
        try {
            var clsBytes = Files.readAllBytes(Path.of(path));
            return defineClass(name, clsBytes, 0, clsBytes.length);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
